{
  "properties" : { },
  "id" : "c76574bb3d69495d9776d1ddcad925ad",
  "script" : null,
  "groupId" : "fe6c046a6a0c4e388989393ac6b92150",
  "name" : "启动",
  "createTime" : null,
  "updateTime" : 1744900059531,
  "lock" : null,
  "createBy" : null,
  "updateBy" : "管理员",
  "path" : "start",
  "method" : "GET",
  "parameters" : [ {
    "name" : "definitionKey",
    "value" : "TestProcess",
    "description" : null,
    "required" : true,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 200,\n    \"msg\": \"success\",\n    \"data\": {\n        \"id\": \"809c7bf2-fa93-11ef-8b05-f4b3016ece8b\",\n        \"name\": \"用户上报\",\n        \"priority\": 50,\n        \"assignee\": \"1003\",\n        \"formData\": {\n            \"reporter\": 1003\n        },\n        \"processInstanceId\": \"809c2dcc-fa93-11ef-8b05-f4b3016ece8b\",\n        \"executionId\": \"809c2dcf-fa93-11ef-8b05-f4b3016ece8b\",\n        \"processDefinitionId\": \"UserReport:1:9cf06bad-fa89-11ef-8b05-f4b3016ece8b\",\n        \"createTime\": \"2025-03-06 22:01:29\",\n        \"taskDefinitionKey\": \"Activity_0qb97zq\",\n        \"tenantId\": \"\",\n        \"formKey\": \"tb_report_info\",\n        \"taskLocalVariables\": {},\n        \"processVariables\": {}\n    }\n}",
  "description" : "指定流程definitionKey 开始，开始后请进入任务操作",
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import 'org.activiti.engine.RuntimeService' as runtimeService;
import 'org.activiti.engine.TaskService' as taskService;
import 'com.wiwf.model.security.service.SysTokenService' as sysTokenService;
import org.activiti.api.process.model.ProcessInstance;
import log;

var user = sysTokenService.getTokenUser(cookie[sysTokenService.getTokenKey()]);
var roleCode = user.roleCode;
var userId = user.userId;

    // 启动流程实例
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(definitionKey, {"reporter": userId});
    // 获取 Task
    Task item = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();

var formData = runtimeService.getVariables(processInstance.getId());

return {
    id: item.getId(), name: item.getName(), description: item.getDescription(), priority: item.getPriority(), 
    owner: item.getOwner(), assignee: item.getAssignee(), formData: formData,
    processInstanceId: item.getProcessInstanceId(), executionId: item.getExecutionId(), 
    processDefinitionId: item.getProcessDefinitionId(), createTime: item.getCreateTime(), taskDefinitionKey: item.getTaskDefinitionKey(),
    dueDate: item.getDueDate(),
    category: item.getCategory(),
    parentTaskId: item.getParentTaskId(), tenantId: item.getTenantId(),
    formKey: item.getFormKey(),
    taskLocalVariables: item.getTaskLocalVariables(),
    processVariables: item.getProcessVariables(),
    claimTime: item.getClaimTime(), businessKey: item.getBusinessKey(),
    delegationState: item.getDelegationState(), appVersion: item.getAppVersion()
}